<?php

/* 
 * taokang----897637176@qq.com
 */
namespace app\blog\controller;
use cmf\controller\AdminBaseController;
use think\Db;

class DiscountlogController extends AdminBaseController{
    
    //促销记录查询
    public function promotionlog(){
        $keywordComplex = [];
        $request = input('request.');
        if(!empty($request['keyword'])){
            $keyword = $request['keyword'];
            $keywordComplex['c_plan|store_name'] = ['like',"%$keyword%"];
        }
        $list = Db::name('promotionlog')->whereOr($keywordComplex)->alias('a')->join('__PROMOTION__ b','a.plog_promotionid=b.c_id','left')->join('__STORE__ c','b.c_shopid=c.id')->field('a.*,b.c_plan,c.store_name')->order('plog_id DESC')->paginate(10);
        $list->appends($request);//保持查询分页不变
        $this->assign('list',$list);
        $this->assign('page',$list);
        return $this->fetch();
    }
    //套餐日志记录查询
    public function setmealog(){

        $keywordComplex = [];
        $request = input('request.');
        if(!empty($request['keyword'])){
            $keyword = $request['keyword'];
            $keywordComplex['set_name|store_name'] = ['like',"%$keyword%"];
        }
        $list = Db::name('setmealog')->whereOr($keywordComplex)->alias('a')->join('__SETMEAL__ b','a.slog_setmealid=b.set_id','left')->join('__STORE__ c','b.set_shopid=c.id')->field('a.*,b.set_name,c.store_name')->order('slog_id DESC')->paginate(10);
        $list->appends($request);//保持查询分页不变
        $this->assign('list',$list);
        $this->assign('page',$list);
        return $this->fetch();
    }
   
}

